import {nextTick, toRaw} from "vue";
import {defineStore} from "pinia";

import {Layout, indexStoreType, SelectIcon, RuleForm} from "./indeStore"
import md5 from "js-md5";
import {getUUIDForFDFB} from "@/utils/common";
import i18n from "@/lang/index";
import {getDefaultOption, defaultGridPanelConfig} from "@/js/table/context.js";
import * as echarts from "echarts";
import {cloneDeep} from "lodash";
import {baseMqttEnum} from "@/stores/enum";

const {t} = i18n.global;
//   analysisStore.$reset();
// store.$patch()
// 编辑区域内容
export const useIndexStore = defineStore({
    id: "useIndexStore",
    state: (): indexStoreType => {
        return ({
            //侧边栏
            sidebar: true,
            mqttClient: {},
            mqttMessage: [],
            mqttNotify: [],
            mqttConnected: false
        }) //为了避免出错，返回的值用()包起来
    },
    getters: {},
    actions: {
        //mqtt传递参数
        resultMqtt(event: any, type: any = baseMqttEnum.MQTT_COMMAND) {
            this.mqttClient.publish(type, JSON.stringify(event));
        }
    },
});
